package com.heima.behavior.controller;

import com.heima.behavior.service.LikeBehaviorService;
import com.heima.model.behavior.LikeBehaviorDto;
import com.heima.model.behavior.ReadBehaviorDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1")
public class LikeBehaviorController {
    @Autowired
    private LikeBehaviorService likeBehaviorService;
    @PostMapping("/likes_behavior")
    public ResponseResult like(@RequestBody LikeBehaviorDto dto){
        return likeBehaviorService.like(dto);
    }

    @PostMapping("/un_likes_behavior")
    public ResponseResult unLike(@RequestBody LikeBehaviorDto dto){
        return likeBehaviorService.unLike(dto);
    }

    @PostMapping("/read_behavior")
    private ResponseResult read(@RequestBody ReadBehaviorDto dto){
        return likeBehaviorService.read(dto);
    }
}
